#pragma once

#include <sstream>
#include "zakengine/zak.h"

using namespace zak;

#include "basestate.h"
#include "goldmine.h"


class GoldMine;
struct Telegram;

//------------------------------------------------------------------------
// UnemptyState: 
// - GoldMine has gold supply.
// - If GoldMine supply falls to 0 switch to EmptyState
//------------------------------------------------------------------------
class UnemptyState : public BaseState<GoldMine>
{
private:

	// Class Constructor
	UnemptyState(){}

	// Copy ctor and assignment should be private
	UnemptyState(const UnemptyState&);
	UnemptyState& operator=(const UnemptyState&);

public:

	// This is a singleton
	static UnemptyState* Instance();

	virtual void Enter(GoldMine* pGoldMine);

	virtual void Execute(GoldMine* pGoldMine);

	virtual void Exit(GoldMine* pGoldMine);

	virtual bool OnMessage(GoldMine* pGoldMine, const Telegram& message);
};

//------------------------------------------------------------------------
// EmptyState: 
// - Mine supplies start to refill slowly. 
// - If gold supply is at full switch to UnemptyState.
//------------------------------------------------------------------------
class EmptyState : public BaseState<GoldMine>
{
private:

	// Class Constructor
	EmptyState(){}

	// Copy ctor and assignment should be private
	EmptyState(const EmptyState&);
	EmptyState& operator=(const EmptyState&);

public:

	// This is a singleton
	static EmptyState* Instance();

	virtual void Enter(GoldMine* pGoldMine);

	virtual void Execute(GoldMine* pGoldMine);

	virtual void Exit(GoldMine* pGoldMine);

	virtual bool OnMessage(GoldMine* pGoldMine, const Telegram& message);
};


//------------------------------------------------------------------------
// GoldMineGlobalState: 
//------------------------------------------------------------------------
class GoldMineGlobalState : public BaseState<GoldMine>
{
private:

	// Class Constructor
	GoldMineGlobalState(){}

	// Copy ctor and assignment should be private
	GoldMineGlobalState(const GoldMineGlobalState&);
	GoldMineGlobalState& operator=(const GoldMineGlobalState&);

public:

	// This is a singleton
	static GoldMineGlobalState* Instance();

	virtual void Enter(GoldMine* pGoldMine);

	virtual void Execute(GoldMine* pGoldMine);

	virtual void Exit(GoldMine* pGoldMine);

	virtual bool OnMessage(GoldMine* pGoldMine, const Telegram& message);
};

